package com.norseman.demo.controller;

import com.norseman.demo.service.model.*;
import com.norseman.demo.service.model.*;

import java.sql.Timestamp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/restfulservice")
public class UserServiceController {

	@Autowired
	UserService userService;
	@Autowired
	UserService userService;

	@RequestMapping(value = "/login", method = RequestMethod.POST)
	@ResponseBody
	public login(@RequestParam("username") String username,
			@RequestParam("password") String password) throws Exception {
		return userService.login(username, password);
	}

	@RequestMapping(value = "/getUserInfo", method = RequestMethod.POST)
	@ResponseBody
	public UserInfo getUserInfo(@RequestParam("username") String username,
			@RequestParam("routeId") int routeId) throws Exception {
		return userService.getUserInfo(username, routeId);
	}

}
